package com.fh.service.business;

import com.fh.dao.DaoSupport;
import com.fh.entity.Page;
import com.fh.util.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service("businessService")
public class BusinessService {

    @Resource(name = "daoSupport")
    private DaoSupport dao;

    /*
    *列表
    */
    public List<PageData> list(Page page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.datalistPage", page);
    }

    /*
     * 列表
     */
    public List<PageData> listAll(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listAll", pd);
    }
    /*
     * 首页展示商圈列表
     */
    public List<PageData> listBuss(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBuss", pd);
    }
    /*
     * 商圈以及商圈下的楼宇列表
     */
    public List<PageData> listBusinessBuilding(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBusinessBuilding", pd);
    }

    /*
    *新增
    */
    public void save(PageData pd) throws Exception {
        dao.save("BusinessMapper.save", pd);
    }

    /*
    *修改
    */
    public void edit(PageData pd) throws Exception {
        dao.update("BusinessMapper.edit", pd);
    }

    /*
    * 通过id获取数据
    */
    public PageData findById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BusinessMapper.findById", pd);
    }

    /*
	* 获取商圈信息select选择框
	 */
    public List<PageData> getBusiness(PageData pd) throws  Exception{
        return (List<PageData>) dao.findForList("BusinessMapper.getBusiness",pd);
    }
    /* ===============================app接口================================== */


    /*
   *经纬度查询
   */
    public List<PageData> listLNG_LAT(PageData page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listLNG_LAT", page);
    }

    /*
    *列表
    */public List<PageData> listBussApp(Page page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.datalistPagelistBussApp", page);
    }

   /* public List<PageData> listBussApp(PageData page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBussApp", page);
    }*/

    /*
     * 首页展示商圈列表
     */
    public List<PageData> tradlist(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.tradlist", pd);
    }
    /*
   * 商圈数据  支出
   */
    public List<PageData> listBussput(PageData page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBussput", page);
    }
    /*
   * 商圈数据  水费
   */
    public List<PageData> listBusswater(PageData page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBusswater", page);
    }
    /*
   * 商圈数据  电费
   */
    public List<PageData> listBusselectric(PageData page) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBusselectric", page);
    }

    public List<PageData> listBussApp(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BusinessMapper.listBussApp", pd);
    }
    /*
     *计算商圈下的房间数量
     */
    public List<PageData> RoomNumber(PageData pd)throws Exception{
        return (List<PageData>)dao.findForList("BuildingMapper.RoomNumber", pd);
    }
}

